package cn.tedu.dictionary.controller;

import cn.tedu.dictionary.base.reponse.JsonResult;
import cn.tedu.dictionary.service.PubSubQueueService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
public class MessageController {

    @Autowired
    private PubSubQueueService pubSubQueueService;
    @PostMapping("/publish/{channel}/{message}")
    public JsonResult publish(@PathVariable String channel, @PathVariable Object message)
    {
        System.out.println("MessageController:thread:"+Thread.currentThread().getName());
        pubSubQueueService.publish(channel,message);
        return new JsonResult();
    }
}
